import java.util.*;

/**
 * Pagination logic test class
 * Used to verify if pagination calculation is correct
 */
public class PaginationTest {
    
    public static void main(String[] args) {
        // Mock data
        List<String> allData = new ArrayList<>();
        for (int i = 1; i <= 25; i++) {
            allData.add("Item" + i);
        }
        
        System.out.println("Total data count: " + allData.size());
        System.out.println("Original data: " + allData);
        System.out.println();
        
        // Test pagination logic
        int pageSize = 10;
        
        // Test page 1
        testPagination(allData, 1, pageSize);
        
        // Test page 2
        testPagination(allData, 2, pageSize);
        
        // Test page 3
        testPagination(allData, 3, pageSize);
        
        // Test page 4 (out of range)
        testPagination(allData, 4, pageSize);
    }
    
    private static void testPagination(List<String> allData, int pageNo, int pageSize) {
        System.out.println("=== Testing page " + pageNo + " ===");
        
        int totalItems = allData.size();
        int start = (pageNo - 1) * pageSize;
        int end = Math.min(start + pageSize, totalItems);
        
        System.out.println("Total items: " + totalItems);
        System.out.println("Page number: " + pageNo);
        System.out.println("Page size: " + pageSize);
        System.out.println("Start index: " + start);
        System.out.println("End index: " + end);
        
        if (start >= totalItems) {
            System.out.println("Page number out of range");
        } else {
            List<String> pagedData = allData.subList(start, end);
            System.out.println("Current page data: " + pagedData);
            System.out.println("Current page data count: " + pagedData.size());
        }
        
        System.out.println();
    }
}
